package com.yuanfeng.order.service.impl;


import com.alibaba.fastjson.JSON;
import com.yuanfeng.commoms.vo.order.DealerOrderGoodsVO;
import com.yuanfeng.order.feign.GoodServiceClient;
import com.yuanfeng.order.mapper.OrderBaseMapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author fwx
 * @date 2021-05-3113:52
 * @Description: 供应商订单支付回调异步接口
 **/
public class SupplyOrderThread implements Runnable{
    private GoodServiceClient goodServiceClient;;
    private OrderBaseMapper orderBaseMapper;
    private String paymentNum;
    private String token;

    public SupplyOrderThread(GoodServiceClient goodServiceClient, OrderBaseMapper orderBaseMapper, String paymentNum, String token) {
        this.goodServiceClient = goodServiceClient;
        this.orderBaseMapper = orderBaseMapper;
        this.paymentNum = paymentNum;
        this.token = token;
    }

    @Override
    public void run() {
        List<DealerOrderGoodsVO> dealerOrderGoodsList = orderBaseMapper.querySupplyOrder(paymentNum);
        Map<String,String> map = new HashMap<>(8);
        map.put("token",token);
        map.put("dealerOrderGoodsList",JSON.toJSONString(dealerOrderGoodsList));
        goodServiceClient.dealerOrderGoods(map);
    }
}
